package LessonPrac;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.Reader;

public class ReaderTest {
    public static void main(String[] args) {
        Reader r = null;
        BufferedReader br = null;

        try {
            r = new FileReader("111.txt");
            br = new BufferedReader(r);

            String str = null;

            //读取一行文本，以\n结束，返回当前的数据，如果返回null读取完毕
            while ((str = br.readLine())!=null){
                System.out.println(str);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            try {
                br.close();;
                r.close();
            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }
}
